package com.example.ccj.u.server;


import retrofit2.CallAdapter;
import retrofit2.Converter;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class ServiceImpl extends RequestDataHolder {
    private static final String TAG = "PublicServiceImpl";
    private volatile static ServiceImpl instance;
//    public static Class<PublicService> SERVICE = PublicService.class; //服务
    protected static Converter.Factory COV_FACTORY = GsonConverterFactory.create(); //数据解析器
    protected static CallAdapter.Factory CALL_FACTORY = RxJava2CallAdapterFactory.create(); //适配器

    protected ServiceImpl(){
        super();
    }

    protected Retrofit getRetrofit() {
        return new Retrofit.Builder()
                .addConverterFactory(COV_FACTORY) //设置数据解析器
                .addCallAdapterFactory(CALL_FACTORY) //适配器
                .baseUrl("http://"+ ADDRESS +":"+PORT+"/")
                .client(getOkHttpClient())
                .build();
//        return retrofit.create(SERVICE);
    }



}
